$function vs:system/game_ctrol/void_shop/slot/read_items/loot_spawn with entity @s data.shopContents[$(index)]

$tag @n[tag=VoidShop.slot,type=item_display,nbt={item:{components:{"minecraft:custom_data":{VoidShopSlot:{id:$(slot)}}}}}] add slot

$data modify entity @n[tag=slot,type=item_display,distance=..10] item.components."minecraft:custom_data".VoidShopSlot.Index set value $(index)

#save data
data modify storage vs:system temp.VS.slot_data set from entity @n[tag=slot,distance=..10,type=item_display] item.components."minecraft:custom_data".VoidShopSlot
data remove storage vs:system temp.VS.slot_data.Item

data modify entity @n[type=item_display,distance=..10,tag=slot] item set from entity @n[type=item,distance=..1,x=0.0,y=0.0,z=0.0,tag=tempItem] Item

#read saved data
data modify entity @n[type=item_display,distance=..10,tag=slot] item.components."minecraft:custom_data".VoidShopSlot set from storage vs:system temp.VS.slot_data
$data modify entity @n[type=item_display,distance=..10,tag=slot] item.components."minecraft:custom_data".VoidShopSlot.Item set from entity @n[tag=VoidShop,distance=..10,type=marker] data.shopContents[$(index)]
$execute if data entity @s data.shopContents[$(index)].override_price run data modify entity @n[tag=slot,distance=..10,type=item_display] item.components."minecraft:custom_data".void_shop.price set from entity @s data.shopContents[$(index)].override_price

#No isNull
execute if entity @n[type=item,distance=..1,x=0.0,y=0.0,z=0.0,tag=tempItem,nbt=!{Item:{components:{"minecraft:custom_data":{id:"shop_null"}}}}] run data remove entity @n[tag=slot,type=item_display,distance=..10,nbt={item:{components:{"minecraft:custom_data":{VoidShopSlot:{isNull:true}}}}}] item.components."minecraft:custom_data".VoidShopSlot.isNull

tag @n[type=item_display,distance=..10,tag=slot] remove slot
kill @n[type=item,distance=..1,x=0.0,y=0.0,z=0.0,tag=tempItem]
data remove storage vs:system temp.VS.slot_data

function vs:system/game_ctrol/void_shop/slot/read_items/re_read